# Maintainer: jelle van der Waa <jelle@vdwaa.nl>
# Contributor: eric <eric@archlinux.org>
# Contributor: Tom Newsom <Jeepster@gmx.co.uk>

pkgname=bonnie++
pkgver=2.00a
pkgrel=3
pkgdesc="Based on the Bonnie hard drive benchmark by Tim Bray"
arch=('loong64' 'x86_64')
url="https://www.coker.com.au/bonnie++/"
license=('GPL')
depends=('perl')
options=(debug)
source=(https://www.coker.com.au/$pkgname/$pkgname-$pkgver.tgz)
sha256sums=('a8d33bbd81bc7eb559ce5bf6e584b9b53faea39ccfb4ae92e58f27257e468f0e')
build() {
  cd "$srcdir"/${pkgname}-${pkgver}

  ./configure --prefix=/usr
  sed \
    -e "s:CFLAGS=-O2  -DNDEBUG \$(WFLAGS) \$(MORECFLAGS):CFLAGS=-std=c++14 ${CFLAGS}:" \
    -e "s:LINK=g++:LINK=g++ ${LDFLAGS}:" \
    -i Makefile
  make V=1
}

package() {
  cd "$srcdir"/${pkgname}-${pkgver}

  # https://www.archlinux.org/todo/move-files-to-usrbin-if-possible/
  sed -i 's/sbin/bin/' Makefile
  make prefix="$pkgdir"/usr install

  install -d "$pkgdir"/usr/share/doc/bonnie++
  install -Dm644 "$srcdir"/$pkgname-$pkgver/readme.html "$pkgdir"/usr/share/doc/bonnie++/readme.html
}

